package com.example.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demo.entity.Article;
import com.example.demo.mapper.ArticleMapper;
import com.example.demo.service.ArticleService;
import org.springframework.stereotype.Service;

@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {
    
    @Override
    public boolean incrementViews(Long id) {
        Article article = this.getById(id);
        if (article != null) {
            article.setViews(article.getViews() + 1);
            return this.updateById(article);
        }
        return false;
    }
} 